/*
 * @Author: rileycai
 * @Date: 2022-03-14 21:18:07
 * @LastEditTime: 2022-03-22 21:17:16
 * @LastEditors: rileycai
 * @Description:
 * @FilePath: /tdesign-miniprogram-starter/pages/order/pay-result/index.js
 */
Page({
    data: {
        amount: 0,
        orderId: '',
        orderType: '',
    },

    onLoad(options) {
        console.log(options)
        const {
            amount = 0, orderId = '', orderType = ''
        } = options;
        this.setData({
            amount,
            orderId,
            orderType,
        });
    },

    onTapReturn(e) {
        const target = e.currentTarget.dataset.type;
        const {
            orderId
        } = this.data;
        if (target === 'home') {
            wx.switchTab({
                url: '/pages/home/home'
            });
        } else if (target === 'orderList') {
            wx.navigateTo({
                url: `/pages/order/order-detail/index?orderNo=${orderId}`,
            });

        } else if (target === 'order') {
            wx.navigateTo({
                url: `/pages/order/order-detail/index?orderNo=${orderId}`,
            });
        } else if (target === 'reservation') {
            wx.navigateTo({
                url: `/pages/course/index?type=00`,
            });
        }
    },

    navBackHandle() {
        wx.navigateBack();
    },
});